package com.googlecode.jcloudsandroid;

import org.jclouds.twitter.TwitterClient;
import org.jclouds.twitter.TwitterContextFactory;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class CloudTweet extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        onLoginClick();
    }

	private void onLoginClick() {
		Button login = (Button) findViewById(R.id.login_button);
		login.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				//TODO start an intent and pass along the credentials for login to the activity that will display tweets
				String user = ((EditText) findViewById(R.id.login_user_edittext)).getText().toString();
				String password = ((EditText) findViewById(R.id.login_password_edittext)).getText().toString();
				TwitterClient tc = TwitterContextFactory.createContext(user, password).getApi();
				tc.getMyMentions();
			}
		});
	}
}